Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Add significance stars to*lincom in esttab

    Dear community,

    I have tried to find a solution to add significance stars to lincom combinations in esttab.

    E.g:

    sysuse auto

    reg price c.mpg##foreign

    lincom 1.foreign + 1.foreign#c.mpg
    estadd scalar lincom = `r(estimate)'
    estadd scalar lincom_se = `r(se)'

    esttab, se replace b(2) ///
    starlevel(* 0.10 ** 0.05 *** 0.01) ///
    stat(lincom lincom_se, labels("1.foreign + 1.foreign#c.mpg" "S.E.") ///
    layout(@ (@)) fmt(2 2) star(lincom) )

    produces the following table:

    ----------------------------
    (1)
    price
    ----------------------------
    mpg -329.26***
    (74.99)

    0.foreign 0.00
    (.)

    1.foreign -13.59
    (2634.66)

    0.foreign#~g 0.00
    (.)

    1.foreign#~g 78.89
    (112.48)

    _cons 12600.54***
    (1527.89)
    ----------------------------
    1.foreign ~g 65.30***
    S.E. (2526.43)
    ----------------------------
    Standard errors in parentheses
    * p<0.10, ** p<0.05, *** p<0.01



    but clearly something went wrong here, since the interaction effect is not supposed to be significant (i.e., using the star(lincom) option is obviously not the correct thing to do). Any suggestions on how to display correct significance stars for individuals coefficients?

    Best,

    Ingar


  • #2
    Statistics in esttab are not coefficients. You have just saved two scalars

    estadd scalar lincom = `r(estimate)'
    estadd scalar lincom_se = `r(se)'
    and from here, you expect esttab to figure out that one is a coefficient and the other is a standard error, and then determine the significance level. Just use the stars() option if the statistic is significant at the lowest level of significance, no option if not significant and revert to manual (insert by hand) if in-between.

    Comment


    • #3
      Thanks for the quick reply. I take away from this that there's no way to automate this process.

      Comment


      • #4
        Not in esttab as is.

        Comment


        • #5
          It seems it's possible by adding the lincomest package.

          I'm sure this can be done more elegantly, but I managed to produce this table using the code below.
          Click image for larger version

Name:	table.png
Views:	1
Size:	26.7 KB
ID:	1466699



          sysuse auto

          reg price c.mpg##foreign

          esttab using table1.tex, se replace keep(mpg 1.foreign 1.foreign#c.mpg) b(2) ///
          starlevel(* 0.10 ** 0.05 *** 0.01) f noobs ///
          coeflabel(mpg "mpg" 1.foreign "foreign" 1.foreign#c.mpg "foreign $\times$ mpg")


          // Add first lincom

          lincomest c.mpg + 1.foreign#c.mpg

          esttab using table1.tex, append coeflabel((1) "mpg + foreign $\times$ mpg") ///
          f collabels(none) gaps plain nomtitles ///
          refcat((1) "\textit{Lincom}", nolabel) starlevel(* 0.10 ** 0.05 *** 0.01) ///
          cells( b(star fmt(2)) se(par fmt(2)) ) ///
          noobs

          // Add second lincom

          reg price c.mpg##foreign
          lincomest 1.foreign + 1.foreign#c.mpg

          esttab using table1.tex, append coeflabel((1) "foreign + foreign $\times$ mpg") ///
          f collabels(none) gaps plain nomtitles ///
          starlevel(* 0.10 ** 0.05 *** 0.01) ///
          cells( b(star fmt(2)) se(par fmt(2)) ) ///
          stat(N, labels("\hline N") fmt(a1))




          Comment

          Working...
          X